package edu.hitwh.record;

import edu.hitwh.entity.Librarian;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LibrarianRecord {
    private Long id;
    private String name;
    private String password;
    private String email;

    public static LibrarianRecord fromEntity(Librarian librarian) {
        return LibrarianRecord.builder()
                .id(librarian.getId())
                .name(librarian.getName())
                .password(librarian.getPassword())
                .email(librarian.getEmail())
                .build();
    }

    public Librarian toEntity() {
        return Librarian.builder()
                .id(id)
                .name(name)
                .password(password)
                .email(email)
                .build();
    }
}
